public class LeetCode {
    public boolean CheckPermutation(String s1, String s2) {
        if(s1.length()!=s2.length()){
            return false;
        }
        int[] str = new int[26];
        int n = s1.length();
        for (int i = 0; i < n; i++) {
            str[s1.charAt(i)-'a']++;
        }
        for (int i = 0; i < n; i++) {
            str[s2.charAt(i)-'a']--;
            if(str[s2.charAt(i)-'a']<0) {
                return false;
            }
        }
        return true;
    }
}
